//
//  HomeMessageController.m
//  JewelryStore
//
//  Created by apple on 2017/1/11.
//  Copyright © 2017年 com. All rights reserved.
//

#import "HomeMessageController.h"
#import "UINavigationBar+Awesome.h"
#import "HomeMessageCell.h"

#define HOMECELL_MESSAGE @"homeMessageCell"

@interface HomeMessageController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@property (nonatomic, strong) UIColor *lastColor;

@end

@implementation HomeMessageController

#pragma maek - cycle life

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    if (_isHomeMessage) {
        
        self.lastColor = self.navigationController.navigationBar.overlay.backgroundColor;
        [self.navigationController.navigationBar lt_setBackgroundColor:kWhite];
        [self.navigationController.navigationBar setTintColor:[UIColor darkGrayColor]];
    }

}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
    if (_isHomeMessage) {
        [self.navigationController.navigationBar lt_setBackgroundColor:self.lastColor];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"消息";
    
    [self.view addSubview:self.tableView];
}

- (UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        //注册cell
        [_tableView registerNib:[UINib nibWithNibName:@"HomeMessageCell" bundle:nil] forCellReuseIdentifier:HOMECELL_MESSAGE];
    }
    return _tableView;
}

#pragma mark - tableView

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    HomeMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:HOMECELL_MESSAGE forIndexPath:indexPath];

    cell.model = @[];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [tableView fd_heightForCellWithIdentifier:HOMECELL_MESSAGE cacheByIndexPath:indexPath configuration:^(id cell) {
        
    }];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}
@end
